import { Module, forwardRef } from '@nestjs/common';
import { RoleService } from './role.service';
import { RoleController } from './role.controller';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Role } from '../../entities/role.entity';
import { CommonModule } from '../../common/common.module';
import { AuthModule } from '../../core/auth/auth.module';
import { PassportModule } from '@nestjs/passport';
import { LocalStrategy } from '../../core/auth/local.strategy';

import { RoleMenu } from '../../entities/role-menu.entity';
import { Menu } from '../../entities/menu.entity';
import { MenuModule } from '../menu/menu.module';
import { User } from '../../entities/user.entity';

@Module({
  imports: [
    TypeOrmModule.forFeature([Role, User, RoleMenu]),
    forwardRef(() => AuthModule), // 处理相互循环依赖
    CommonModule,
    MenuModule,
    PassportModule,
  ],
  controllers: [RoleController],
  providers: [RoleService],
  exports: [RoleService],
})
export class RoleModule {}
